﻿using System;
using WeiSha.Core.Param.Method;
using WeiSha.Core.Templates;

namespace WeiSha.Core
{
	// Token: 0x02000029 RID: 41
	public class Template
	{
		// Token: 0x17000084 RID: 132
		// (get) Token: 0x06000162 RID: 354 RVA: 0x0000A390 File Offset: 0x00008590
		public static TemplateConfingItem[] All
		{
			get
			{
				return Template._all;
			}
		}

		// Token: 0x17000085 RID: 133
		// (get) Token: 0x06000163 RID: 355 RVA: 0x0000A3A8 File Offset: 0x000085A8
		public static TemplateConfingItem ForWeb
		{
			get
			{
				return Template.ForAny("Web");
			}
		}

		// Token: 0x17000086 RID: 134
		// (get) Token: 0x06000164 RID: 356 RVA: 0x0000A3C4 File Offset: 0x000085C4
		public static TemplateConfingItem ForMobile
		{
			get
			{
				return Template.ForAny("Mobi");
			}
		}

		// Token: 0x06000165 RID: 357 RVA: 0x0000A3E0 File Offset: 0x000085E0
		public static TemplateConfingItem ForAny(string type)
		{
			TemplateConfingItem templateConfingItem = null;
			bool flag = Template._all == null;
			if (flag)
			{
				Template._all = Template.GetTemplateSorts();
			}
			foreach (TemplateConfingItem templateConfingItem2 in Template._all)
			{
				bool flag2 = type.Equals(templateConfingItem2.Key, StringComparison.CurrentCultureIgnoreCase);
				if (flag2)
				{
					templateConfingItem = templateConfingItem2;
					break;
				}
			}
			return templateConfingItem;
		}

		// Token: 0x06000166 RID: 358 RVA: 0x0000A444 File Offset: 0x00008644
		public static TemplateConfingItem[] GetTemplateSorts()
		{
			PlatformInfoHandler.SiteInfoHandlerParaNode siteInfoHandlerParaNode = PlatformInfoHandler.Node(Template.TemplateNodeName);
			TemplateConfingItem[] array = new TemplateConfingItem[siteInfoHandlerParaNode.Children.Length];
			for (int i = 0; i < array.Length; i++)
			{
				PlatformInfoHandler.SiteInfoHandlerParaNode siteInfoHandlerParaNode2 = siteInfoHandlerParaNode.Children[i];
				array[i] = new TemplateConfingItem(siteInfoHandlerParaNode2.Key);
			}
			return array;
		}

		// Token: 0x06000167 RID: 359 RVA: 0x0000A49F File Offset: 0x0000869F
		public static void RefreshTemplate()
		{
			Template._all = Template.GetTemplateSorts();
		}

		// Token: 0x17000087 RID: 135
		// (get) Token: 0x06000168 RID: 360 RVA: 0x0000A4AC File Offset: 0x000086AC
		public static _Path Path
		{
			get
			{
				bool flag = Template._path == null;
				if (flag)
				{
					string text = PlatformInfoHandler.Node(Template.TemplateNodeName).Attribute("path");
					Template._path = new _Path(text, null);
				}
				return Template._path;
			}
		}

		// Token: 0x17000088 RID: 136
		// (get) Token: 0x06000169 RID: 361 RVA: 0x0000A4F4 File Offset: 0x000086F4
		public static bool IsTrim
		{
			get
			{
				bool flag = Template._isTrim == null;
				if (flag)
				{
					string text = PlatformInfoHandler.Node(Template.TemplateNodeName).Attribute("trim");
					Template._isTrim = new bool?(new ConvertToAnyValue(text).Boolean.GetValueOrDefault());
				}
				return Template._isTrim.Value;
			}
		}

		// Token: 0x17000089 RID: 137
		// (get) Token: 0x0600016A RID: 362 RVA: 0x0000A558 File Offset: 0x00008758
		public static bool IsCache
		{
			get
			{
				bool flag = Template._iscache == null;
				if (flag)
				{
					string text = PlatformInfoHandler.Node(Template.TemplateNodeName).Attribute("cache");
					Template._iscache = new bool?(new ConvertToAnyValue(text).Boolean.GetValueOrDefault());
				}
				return Template._iscache.Value;
			}
		}

		// Token: 0x1700008A RID: 138
		// (get) Token: 0x0600016B RID: 363 RVA: 0x0000A5BC File Offset: 0x000087BC
		public static string Homepage
		{
			get
			{
				bool flag = string.IsNullOrEmpty(Template._homepage);
				if (flag)
				{
					string text = PlatformInfoHandler.Node(Template.TemplateNodeName).Attribute("homepage");
					Template._homepage = new ConvertToAnyValue(text).String;
				}
				return Template._homepage;
			}
		}

		// Token: 0x04000060 RID: 96
		public static readonly string TemplateNodeName = "Template";

		// Token: 0x04000061 RID: 97
		private static TemplateConfingItem[] _all = Template.GetTemplateSorts();

		// Token: 0x04000062 RID: 98
		private static _Path _path = null;

		// Token: 0x04000063 RID: 99
		private static bool? _isTrim = null;

		// Token: 0x04000064 RID: 100
		private static bool? _iscache = null;

		// Token: 0x04000065 RID: 101
		private static string _homepage = string.Empty;
	}
}
